using System;

namespace IllSoft.Xvcc.Volano
{
    // v2.6.2.1
    public enum ServerCommand : byte
    {
        AudioAlarm = 0xD8,
        Authentication = 0x01,
        ChannelJoin = 0xD7,
        ChannelList = 0xD1,
        ChannelPart = 0xCE,
        Message = 0xD0,
        Ping = 0xD2,
        QueryClose = 0xCB,
        QueryRequest = 0xC9,
        UserList = 0xCF,
        Whisper = 0xFE
    }

    // v2.7.1
    //public enum ServerCommand : byte
    //{
    //    AudioAlarm = 0xD3,
    //    Authentication = 0x01,
    //    ChannelJoin = 0xD0,
    //    ChannelList = 0xD7,
    //    ChannelPart = 0xCF,
    //    Message = 0xCA,
    //    Ping = 0xD4,
    //    QueryClose = 0xCE,
    //    QueryRequest = 0xD9,
    //    UserList = 0xD2,
    //    Whisper = 0xFE // Prolly wrong but can't test it right now
    //}

    /// <summary>
    /// Contains all commands which the server understands.
    /// </summary>
    internal sealed class ClientCommand
    {
        private static readonly ClientCommand instance = new ClientCommand();

        #region Client commands
        /// <summary>Tells the server to send an audio alarm to an user.</summary>
        //public static readonly byte[] AudioAlarm = new byte[] {0x00, 0xD1, 0x00, 0x00, 0x00, 0x01};
        public static readonly byte[] AudioAlarm = new byte[] { 0x00, (byte)ServerCommand.AudioAlarm, 0x00, 0x00, 0x00, 0x01 };

        /// <summary>Tells the server that we are a valid client.</summary>
        //public static readonly byte[] GetAccess = new byte[] {0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00};
        public static readonly byte[] Authentication = new byte[] { 0x00, (byte)ServerCommand.Authentication, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00 };

        /// <summary>Tells the server to join a channel.</summary>
        //public static readonly byte[] ChannelJoin = new byte[] {0x00, 0xD4, 0x00, 0x00, 0x00, 0x01};
        public static readonly byte[] ChannelJoin = new byte[] { 0x00, (byte)ServerCommand.ChannelJoin, 0x00, 0x00, 0x00, 0x01 };

        /// <summary>Tells the server to leave a channel.</summary>
        //public static readonly byte[] ChannelLeave = new byte[] {0x00, 0xCA, 0x00, 0x00, 0x00, 0x01};
        public static readonly byte[] ChannelPart = new byte[] { 0x00, (byte)ServerCommand.ChannelPart, 0x00, 0x00, 0x00, 0x01 };

        /// <summary>Tells the server to request a channel list.</summary>
        public static readonly byte[] ChannelList = new byte[] { 0x00, (byte)ServerCommand.ChannelList, 0x00, 0x00, 0x00, 0x01 };

        /// <summary>Tells the server to write a message to a channel.</summary>
        //public static readonly byte[] ChannelMessage = new byte[] {0x00, 0xD5, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00};
        public static readonly byte[] ChannelMessage = new byte[] { 0x00, (byte)ServerCommand.Message, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00 };

        /// <summary>Tells the server that we are still alive.</summary>
        //public static readonly byte[] Pong = new byte[] {0x00, 0xD3, 0x00, 0x00, 0x00, 0x03};
        public static readonly byte[] Pong = new byte[] { 0x00, (byte)ServerCommand.Ping, 0x00, 0x00, 0x00, 0x03 };

        /// <summary>Tells the server to close a query.</summary>
        //public static readonly byte[] QueryClose = new byte[] {0x00, 0xCC, 0x00, 0x00, 0x00, 0x01, 0x00};
        public static readonly byte[] QueryClose = new byte[] { 0x00, (byte)ServerCommand.QueryClose, 0x00, 0x00, 0x00, 0x01, 0x00 };

        /// <summary>Tells the server to write a message to a query.</summary>
        //public static readonly byte[] QueryMessage = new byte[] {0x00, 0xD5, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00};
        public static readonly byte[] QueryMessage = new byte[] { 0x00, (byte)ServerCommand.Message, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00 };

        /// <summary>Tells the server that we request a query.</summary>
        //public static readonly byte[] QueryRequest = new byte[] {0x00, 0xD7, 0x00, 0x00, 0x00, 0x01};
        public static readonly byte[] QueryRequest = new byte[] { 0x00, (byte)ServerCommand.QueryRequest, 0x00, 0x00, 0x00, 0x01 };

        /// <summary>Tells the server to process our authentication/challenge response</summary>
        //public static readonly byte[] Response = new byte[] {0x00, 0xD6, 0x00, 0x00, 0x00, 0x01};

        /// <summary>Tells the server to send a user list of a channel.</summary>
        //public static readonly byte[] GetUserList = new byte[] {0x00, 0xD2, 0x00, 0x00, 0x00, 0x01};
        public static readonly byte[] UserList = new byte[] { 0x00, (byte)ServerCommand.UserList, 0x00, 0x00, 0x00, 0x01 };

        /// <summary>Tells the server to whisper with someone.</summary>
        //public static readonly byte[] Whisper = new byte[] {0x00, 0xCE, 0x00, 0x00, 0x00, 0x02};
        public static readonly byte[] Whisper = new byte[] { 0x00, (byte)ServerCommand.Whisper, 0x00, 0x00, 0x00, 0x02 };
        #endregion

        #region (De-)Constructor(s)

        // Explicit static constructor to tell C# compiler not to mark type as beforefieldinit
        static ClientCommand()
        {
        }

        private ClientCommand()
        {
        }

        #endregion
    }
}